import 'package:dio/dio.dart';
import 'package:t_upgrade_plugin/network/upgrade_http_client.dart';

abstract class UpgradeService {
  static Dio _dio = UpgradeHttpClient().dio;
  static final String _queryApp = '/v/queryApp/';

  static Future<Response> checkAppVersion(Map<String, dynamic> parameters) async {
    Response response = await _dio.get(_queryApp, queryParameters: parameters);
    return response;
  }

  static Future<Response> downLoadFile(String urlPath, String saveFilePatch, ProgressCallback onReceiveProgress) async {
    return _dio.download(urlPath, saveFilePatch, options: Options(receiveTimeout: 200 * 1000, sendTimeout: 200 * 1000),
        onReceiveProgress: (received, total) {
      onReceiveProgress(received, total);
    });
  }
}
